//
//  ZH_RefundReasonTableViewCell.m
//  WisdomStar
//
//  Created by zhangliwen on 2018/10/31.
//  Copyright © 2018年 zhangliwen. All rights reserved.
//

#import "ZH_RefundReasonTableViewCell.h"
@interface ZH_RefundReasonTableViewCell()
@property (nonatomic,weak)UIView *cricleView;
@property (nonatomic,weak)UILabel *titleLabel;
@property (nonatomic,weak)UITextField *textField;
@end
@implementation ZH_RefundReasonTableViewCell

+(instancetype)cellWithTableView:(UITableView*)tableView
{
    static NSString *ID = @"ZH_RefundReasonTableViewCell";
    ZH_RefundReasonTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if(cell == nil){
        cell = [[ZH_RefundReasonTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}
- (void)initDefault{
    [self unShowClickEffect];
}
- (void)loadSubviewConstraints{
    [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(FITSCALE(15));
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(FITSCALE(25));
    }];
    [self.cricleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(FITSCALE(9));
        make.width.mas_equalTo(FITSCALE(9));
        make.height.mas_equalTo(FITSCALE(9));
    }];
    [self.textField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(FITSCALE(105));
        make.height.mas_equalTo(FITSCALE(34));
        make.right.equalTo(self.contentView).offset(FITSCALE(-20));
    }];
}
///输入框 回调 方法
- (void)textFieldDidEndEditing:(UITextField *)textField
{
    //    if(self.onEnterTextFieldBlock){
    //        self.onEnterTextFieldBlock(textField.text, textField.tag);
    //    }
}

-(BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [self.textField endEditing:YES];
    return YES;
}

#pragma mark - getter,setter
- (UIView *)cricleView{
    if (!_cricleView) {
        UIView *view = [UIView createViewWithBackgroundColor:[UIColor colorWithHexString:@"#DFDFDF"]];
        view.layer.cornerRadius = FITSCALE(4);
        view.layer.masksToBounds = YES;
        view.clipsToBounds = YES;
        [self.contentView addSubview:_cricleView = view];
    }
    return _cricleView;
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [UILabel createLabelWithText:@"退款原因:" font:kFontSize_28];
        [self.contentView addSubview:_titleLabel = label];
    }
    return _titleLabel;
}
- (UITextField *)textField
{
    if(!_textField){
        UITextField *textField = [UITextField createTextFieldWithPlaceholder:@"" placeholderColor:kFontColorGray delegateTarget:self];
        textField.borderStyle = UITextBorderStyleNone;
        textField.backgroundColor = [UIColor colorWithHexString:@"#DFDFDF"];
        textField.font = kFontSize_28;
        textField.textAlignment = NSTextAlignmentLeft;
        textField.returnKeyType = UIReturnKeyDone;
        [textField setTextColor:kFontColorBlack];
        [self.contentView addSubview:_textField = textField];
    }
    return _textField;
}
@end
